<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="https://www.thymeleaf.org"
      xmlns:sec="https://www.thymeleaf.org/thymeleaf-extras-springsecurity5">
    <head>
        <title>Hello</title>
    </head>
    <body>
        <div sec:authorize="hasRole('ROLE_USER')">
            Hello <span th:text="${#authentication.name}"></span>!
        </div>
        <div sec:authorize="isAuthenticated()">
            Logged in user: <span sec:authentication="name"></span> |
            Roles: <span sec:authentication="principal.authorities"></span>
        </div>
    </body>
</html>